<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
  <head>
    <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dijit/themes/claro/claro.css" />
    <link rel="stylesheet" href="atca_calibrators.css" />
    <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js">
      djConfig={
      parseOnLoad: true,
      isDebug: true,
      baseUrl: "./",
      };
    </script>
    <script type="text/javascript" src="sprintf-0.7-beta1.js"></script>
    <script src="atca_calibrators.js"></script>
    <script language="javascript" type="text/javascript">
      function init() {
      
        // the node we use as the top level
        var DOMnode = dojo.byId('contentDiv');

        getOptions();
      
        if ((!options.rarange) &&
            (!options.decrange) &&
            (!options.radec) &&
            (!options.theta)) {
          DOMnode.appendChild(dojo.create('div', {
            innerHTML: 'Not enough information specified!' }));
          return;
        }

        var pageHeader;
        var actionContent;
        if ((options.rarange) && (options.decrange)) {
          pageHeader = dojo.create('div', {
            'class': 'sourceHeader',
            innerHTML: 'Calibrators in the range RA=' +
              options.rarange + ' DEC=' + options.decrange });
          actionContent = { action: 'caltable',
            rarange: options.rarange[0] + ',' + options.rarange[1], 
            decrange: options.decrange[0] + ',' + options.decrange[1] };
        } else if ((options.radec) && (options.theta)) {
          pageHeader = dojo.create('div', {
            'class': 'sourceHeader',
            innerHTML: 'Calibrators near ' + options.radec });
          actionContent = { action: 'calnear',
            radec: options.radec[0] + ',' + options.radec[1],
            theta: options.theta };
        }

        if (options.flimit && options.band) {
          actionContent.flimit = options.flimit;
          actionContent.band = options.band;
        }

        DOMnode.appendChild(pageHeader);
      
        document.title += ' - ' + pageHeader.innerHTML;

        DOMnode.appendChild(dojo.create('div', {
          id: 'calTableDiv' }));
        insertLoadingImage(dojo.byId('calTableDiv'));

        // get some information from the database
        dojo.xhrPost({
          url: '/cgi-bin/Calibrators/new/calinfo_json.pl' ,
          sync: false,
          content: actionContent,
          handleAs: 'json',
          load: drawCalTablePage,
          error: function(error, ioargs){
            alert(error);
          }
        });
      
      }
      
      dojo.addOnLoad(init);
    </script>
    <title>ATCA Calibrators</title>
  </head>
  <body class="claro">
    <div class="topbacking">
      <div class="csirologo">
	<a href="http://www.csiro.au/">
	  <img src="csiro50spaced.gif" /></a>
      </div>
      <div class="main">
	<span class="cass">CSIRO Astronomy and Space Science</span>
	<br />
	<span class="pagetitle">ATCA Calibrator Database</span>
      </div>
      <div class="csiroend"><img src="green50.gif" /></div>
    </div>
    <div class="content" id="contentDiv">

    </div>
  </body>
</html>
